<link rel="stylesheet" type="text/css" href="{$atplPath}skin/admin2013_child.css" />
<link rel="stylesheet" type="text/css" href="{$atplPath}js/facebox.css" />
<link rel="stylesheet" href="/kindeditor/themes/default/default.css?{$CacheHash}" />
<script src="{$atplPath}js/jquery-1.10.2.min.js"></script>
<script src="{$atplPath}js/jquery.cookie.js"></script>
<script charset="utf-8" src="/kindeditor/kindeditor.js?{$CacheHash}"></script>
<script charset="utf-8" src="/kindeditor/lang/zh_CN.js?{$CacheHash}"></script>
<script>var siteUrl = '{$SiteUrl}';window['logincookieStr'] = $.cookie('{$adminlogincookieName}')+'&'+$.cookie('{$Codestate}');</script>
<style>
#fangxing{   margin:0;padding:0;}
#fangxing ul{list-style-type:none; margin:0;padding:0;}
#fangxing ul li{ width:50%; float:left;}
.my_prop_img{ width:100%; margin:0; padding:0;}
.my_prop_imgitem{ width:122px;float:left; display:inline;margin:15px 15px 15px 0; position:relative; *zoom:1; z-index:1; text-align:center}
.my_prop_imgitem .move_prev,.my_prop_imgitem .move_next,.my_prop_imgitem .set_FM { display:block; position:absolute; top:0; left:0; width:40px; background:#000; opacity:.8; color:#fff; font-weight:normal; padding:2px 0; text-align:center;}
.my_prop_imgitem .move_next { left:41px;}
.my_prop_imgitem .set_FM { top:104px; width:auto; padding:2px 5px;}
.i_img_alt { width:114px;}
</style>

<table align="center" cellpadding="2" width="100%" cellspacing="0" class="toptable grid table_style table_style_2017" border="0">
	<tr>
		<th style="text-align:left; padding-left:12px;" colspan="3">修改“{$chrloupan}”小区的房型图、相册</th>
		<th style="text-align:right; padding-right:10px;"><a href="xiaoqu.aspx" class="global_btn">返回上一级</a></th>
	</tr>
</table>
<div class="fields_input" style="border:1px solid #eee; background-color:#fff; line-height:32px;">
			<ul class="clearfix">
				<li class="geduan" style="margin-top:0; background-color:#fafafa;">房型图</li>
				<form name="form1" method="post" action="?action=e1save" onsubmit="return checkhousehuxing(this)" enctype="multipart/form-data">
				<input type="hidden" name="loupanid1" value="{$ID}">
				<li>
					<span class="a">添加房型：</span>
					<span class="d"><input name="shi" id="shi" class="s_ipt" style="width:25px;" onKeyUp="value=value.replace(/\D+/g,'')"> 室 <input name="ting" id="ting" class="s_ipt" style="width:25px;" onKeyUp="value=value.replace(/\D+/g,'')" > 厅 <input name="wei" id="wei" class="s_ipt" style="width:25px;" onKeyUp="value=value.replace(/\D+/g,'')"> 卫　　　面积：<input name="chrsize" id="chrsize" class="s_ipt" style="width:40px;" > 平米　　　图片： <input type="file" name="file" class="s_ipt"> <input type="submit" name="Submit" class="global_btn_blue_big" value="提交">　<em class="global_tip">最佳尺寸：600x727</em></span>
				</li>
				<input type="hidden" name="filewidth" value="600">
				<input type="hidden" name="fileheight" value="727">
				<input type="hidden" name="smallfilewidth" value="213">
				<input type="hidden" name="smallfileheight" value="258">
				</form>
				<li>
					<span class="a">已上传房型：</span>
					<span class="d">
						<div id="fangxing"><ul>{$list1}</ul></div>
					</span>
				</li>
				<li class="geduan">小区相册</li>
				<li>
					<span class="a">已上传图片：</span>
					<span class="d">
		<input type="button" id="J_selectImage" value="批量上传" />　<em class="global_tip">最佳尺寸：800x650</em>
		<div id="J_imageView" class="clearfix"></div>
		<input type="hidden" name="urlhidden" id="urlhidden" value="" />
		<input type="hidden" name="urlmark" id="urlmark" value="" />
	
	<div id="xiangce" class="clearfix"><tag:Loop ListType="LISTXIAOQUPIC" RecType="New" PageSize="50" ColorSplit="1" TitleLen="55" RecColumn="4" CusTpl="0" Template="house/Listphoto_tr.htm" /></div></span>
				</li>
				<li>
					<span class="a">&nbsp;</span>
					<span class="b"><input type="button" name="Submit"  onclick="window.location.href='xiaoqu.aspx?action=edit&id={$ID}';" class="global_btn_big" value="返回小区信息页">　<input type="button" name="Submit"  onclick="window.location.href='xiaoqu.aspx';" class="global_btn_big" value="返回小区列表页"></span>
				</li>
			</ul>
		</div>
<input type="hidden" name="gotourl" value="{$gotourl}">
<input type="hidden" name="id" value="{$id}">
<input type="hidden" name="over" value="0">
<script type="text/javascript" src="{$atplPath}js/facebox.js"></script>
<script>
var table_id = 'house_xiaoqu_pic';
KindEditor.ready(function(K) {
	var editor = K.editor({
		uploadJson : '/kindeditor/upload_json.ashx?table_id='+table_id+'&'+window["logincookieStr"],
		afterBlur: function(){this.sync();},
		fileManagerJson : '/kindeditor/file_manager_json.ashx',
		allowFileManager : true,width : '100%',height : '500px'
	});
	K('#J_selectImage').click(function() {
		editor.loadPlugin('multiimage', function() {
			editor.plugin.multiImageDialog({
				clickFn : function(urlList) {
					var i=0;
					jQuery("#urlhidden").val();
					jQuery("#urlmark").val();
					K.each(urlList, function(i, data) {
						if( jQuery("#urlhidden").val()=="" ){
							jQuery("#urlhidden").val(data.id);
						}else{
							jQuery("#urlhidden").val(jQuery("#urlhidden").val()+","+data.id);
						}
						i++;
					});
					saveMyImage();
					editor.hideDialog();
				}
			});
		});
	});
});
function saveMyImage(){
	var urlhidden = jQuery('#urlhidden').val();
	var urlmark = jQuery('#urlmark').val();
	var url = '/request.ashx?action=picBatchUpload&table_id='+table_id+'&id={$ID}&isadmin=1&urlhidden='+urlhidden+'&urlmark='+urlmark+'&smallfilewidth=278&smallfileheight=226&timer=' + new Date();
	jQuery.ajax({url:url,success:function(data){
		if(data.islogin === '1'){
			showMyImage(data['MSG']);
		}else{
			alert(data);
		}
	}});
}
function showMyImage(o){
	var txt='',node = jQuery('#xiangce');
	for(var i=0;i<o.length;i++){
		txt='<div class="my_prop_imgitem">'+
			'<div  style="border:1px solid #cccccc; margin-bottom:5px;"><img src="'+o[i]["url"]+'" width="120"  height="120" style="vertical-align:middle;"/></div>'+
			'<input type="text" value="'+o[i]["chrmark"]+'" onblur="editMark(this,\''+o[i]["id"]+'\')" class="i_img_alt" />'+
			'<a href="javascript:" onclick="delfile(this,\''+o[i]["id"]+'\',\'5\')">删除</a>'+
			'<a href="#" onclick="return move_PrevNext(this,0,0,\''+o[i]["id"]+'\',\'setfile\',\'house_xiaoqu_pic&loupanid={$ID}\',8);" class="move_prev">前移</a>'+
			'<a href="#" onclick="return move_PrevNext(this,1,0,\''+o[i]["id"]+'\',\'setfile\',\'house_xiaoqu_pic&loupanid={$ID}\',8);" class="move_next">后移</a>'+
			'</div>';
		node.append(jQuery(txt));
	}
	reset_moveBtn();
}
function editMark(o,id){
	var chrmark = jQuery(o).val();
	var url = '/request.ashx?action=setpicmark&table_id='+table_id+'&id='+id+'&chrmark='+encodeURIComponent(chrmark)+'&timer=' + new Date();
	jQuery.ajax({url:url,success:function(data){
		if(data.islogin === '1'){
			//alert('图片注释编辑成功！');
		}else{
			alert(data);
		}
	}});
}
</script>
<script>
$.noConflict();
(function($){
	$('a[class*=lightwindow]').facebox();
})(jQuery);
function delfile(o,sid){
	if ( confirm("该操作将不可逆！\n您确定要删除吗？")){
		var url = '/request.ashx?action=delpic&id='+sid+'&table_id='+table_id;
		var Digital=new  Date();
		Digital=Digital+40000;
		url=url+"&k="+encodeURIComponent(Digital);
		
		jQuery.ajax({url:url,success:function(data){
			if(data.islogin == '1'){
				alert('删除成功！');
				jQuery(o).parent().remove();
			}else{
				alert(data['error']);
			}
		}});
	}
}
function reset_moveBtn(){
	var node = jQuery('#xiangce');
	if(node.length<1){return;}
	node.find('.move_next,.move_prev').show();
	node.find('.move_next').css({'left':'41px'});
	node.find('.my_prop_imgitem:last .move_next').hide();
	node.find('.my_prop_imgitem:first .move_prev').hide();
	node.find('.my_prop_imgitem:first .move_next').css({'left':'0'});
}
reset_moveBtn();
function move_PrevNext(o,index,sortval,picid,pageid,tableid,total){
	var url = siteUrl+'request.ashx?action=picmove&pn='+index+'&id='+picid+'&intorder='+sortval+'&table_id='+tableid;
	var Digital=new  Date();
	Digital=Digital+40000;
	url=url+"&k="+encodeURIComponent(Digital);
	var ht = jQuery(o).parent(),ht2 = '';

	jQuery.ajax({url:url,success:function(data){
		if(data.islogin == '1'){
			if(index === 0){
				ht2 = ht.prev();
				ht.detach().insertBefore(ht2);
			}else{
				ht2 = ht.next();
				ht.detach().insertAfter(ht2);
			}
			reset_moveBtn();
		}else{
			alert(data['error']);
		}
	}});
	return false;
}
</script>
</body>
</html>